home *** CD-ROM | disk | FTP | other *** search
/ Kompuutteri K-CD 2002 #1 / K-CD_2002-01.iso / Delphi / INSTALL / program files / Borland / Delphi6 / Doc / Grids.int < prev    next >
Encoding:
Text File  |  2001-05-22  |  23.7 KB  |  589 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Borland Delphi Visual Component Library         }
  5. {                                                       }
  6. {  Copyright (c) 1995-2001 Borland Software Corporation }
  7. {                                                       }
  8. {*******************************************************}
  9.  
  10. unit Grids;
  11.  
  12. {$R-,T-,H+,X+}
  13.  
  14. interface
  15.  
  16. uses Messages, {$IFDEF LINUX} WinUtils, {$ENDIF} Windows, SysUtils, Classes,
  17.   Variants, Graphics, Menus, Controls, Forms, StdCtrls, Mask;
  18.  
  19. const
  20.   MaxCustomExtents = MaxListSize;
  21.   MaxShortInt = High(ShortInt);
  22.  
  23. type
  24.   EInvalidGridOperation = class(Exception);
  25.  
  26.   { Internal grid types }
  27.   TGetExtentsFunc = function(Index: Longint): Integer of object;
  28.  
  29.   TGridAxisDrawInfo = record
  30.     EffectiveLineWidth: Integer;
  31.     FixedBoundary: Integer;
  32.     GridBoundary: Integer;
  33.     GridExtent: Integer;
  34.     LastFullVisibleCell: Longint;
  35.     FullVisBoundary: Integer;
  36.     FixedCellCount: Integer;
  37.     FirstGridCell: Integer;
  38.     GridCellCount: Integer;
  39.     GetExtent: TGetExtentsFunc;
  40.   end;
  41.  
  42.   TGridDrawInfo = record
  43.     Horz, Vert: TGridAxisDrawInfo;
  44.   end;
  45.  
  46.   TGridState = (gsNormal, gsSelecting, gsRowSizing, gsColSizing,
  47.     gsRowMoving, gsColMoving);
  48.   TGridMovement = gsRowMoving..gsColMoving;
  49.  
  50.   { TInplaceEdit }
  51.   { The inplace editor is not intended to be used outside the grid }
  52.  
  53.   TCustomGrid = class;
  54.  
  55.   TInplaceEdit = class(TCustomMaskEdit)
  56.   protected
  57.     procedure CreateParams(var Params: TCreateParams); override;
  58.     procedure DblClick; override;
  59.     function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer;
  60.       MousePos: TPoint): Boolean; override;
  61.     function EditCanModify: Boolean; override;
  62.     procedure KeyDown(var Key: Word; Shift: TShiftState); override;
  63.     procedure KeyPress(var Key: Char); override;
  64.     procedure KeyUp(var Key: Word; Shift: TShiftState); override;
  65.     procedure BoundsChanged; virtual;
  66.     procedure UpdateContents; virtual;
  67.     procedure WndProc(var Message: TMessage); override;
  68.     property  Grid: TCustomGrid;
  69.   public
  70.     constructor Create(AOwner: TComponent); override;
  71.     procedure Deselect;
  72.     procedure Hide;
  73.     procedure Invalidate; reintroduce;
  74.     procedure Move(const Loc: TRect);
  75.     function PosEqual(const Rect: TRect): Boolean;
  76.     procedure SetFocus; reintroduce;
  77.     procedure UpdateLoc(const Loc: TRect);
  78.     function Visible: Boolean;
  79.   end;
  80.  
  81.   { TCustomGrid }
  82.  
  83.   { TCustomGrid is an abstract base class that can be used to implement
  84.     general purpose grid style controls.  The control will call DrawCell for
  85.     each of the cells allowing the derived class to fill in the contents of
  86.     the cell.  The base class handles scrolling, selection, cursor keys, and
  87.     scrollbars.
  88.       DrawCell
  89.         Called by Paint. If DefaultDrawing is true the font and brush are
  90.         intialized to the control font and cell color.  The cell is prepainted
  91.         in the cell color and a focus rect is drawn in the focused cell after
  92.         DrawCell returns.  The state passed will reflect whether the cell is
  93.         a fixed cell, the focused cell or in the selection.
  94.       SizeChanged
  95.         Called when the size of the grid has changed.
  96.       BorderStyle
  97.         Allows a single line border to be drawn around the control.
  98.       Col
  99.         The current column of the focused cell (runtime only).
  100.       ColCount
  101.         The number of columns in the grid.
  102.       ColWidths
  103.         The width of each column (up to a maximum MaxCustomExtents, runtime
  104.         only).
  105.       DefaultColWidth
  106.         The default column width.  Changing this value will throw away any
  107.         customization done either visually or through ColWidths.
  108.       DefaultDrawing
  109.         Indicates whether the Paint should do the drawing talked about above in
  110.         DrawCell.
  111.       DefaultRowHeight
  112.         The default row height.  Changing this value will throw away any
  113.         customization done either visually or through RowHeights.
  114.       FixedCols
  115.         The number of non-scrolling columns.  This value must be at least one
  116.         below ColCount.
  117.       FixedRows
  118.         The number of non-scrolling rows.  This value must be at least one
  119.         below RowCount.
  120.       GridLineWidth
  121.         The width of the lines drawn between the cells.
  122.       LeftCol
  123.         The index of the left most displayed column (runtime only).
  124.       Options
  125.         The following options are available:
  126.           goFixedHorzLine:     Draw horizontal grid lines in the fixed cell area.
  127.           goFixedVertLine:     Draw veritical grid lines in the fixed cell area.
  128.           goHorzLine:          Draw horizontal lines between cells.
  129.           goVertLine:          Draw vertical lines between cells.
  130.           goRangeSelect:       Allow a range of cells to be selected.
  131.           goDrawFocusSelected: Draw the focused cell in the selected color.
  132.           goRowSizing:         Allows rows to be individually resized.
  133.           goColSizing:         Allows columns to be individually resized.
  134.           goRowMoving:         Allows rows to be moved with the mouse
  135.           goColMoving:         Allows columns to be moved with the mouse.
  136.           goEditing:           Places an edit control over the focused cell.
  137.           goAlwaysShowEditor:  Always shows the editor in place instead of
  138.                                waiting for a keypress or F2 to display it.
  139.           goTabs:              Enables the tabbing between columns.
  140.           goRowSelect:         Selection and movement is done a row at a time.
  141.       Row
  142.         The row of the focused cell (runtime only).
  143.       RowCount
  144.         The number of rows in the grid.
  145.       RowHeights
  146.         The hieght of each row (up to a maximum MaxCustomExtents, runtime
  147.         only).
  148.       ScrollBars
  149.         Determines whether the control has scrollbars.
  150.       Selection
  151.         A TGridRect of the current selection.
  152.       TopLeftChanged
  153.         Called when the TopRow or LeftCol change.
  154.       TopRow
  155.         The index of the top most row displayed (runtime only)
  156.       VisibleColCount
  157.         The number of columns fully displayed.  There could be one more column
  158.         partially displayed.
  159.       VisibleRowCount
  160.         The number of rows fully displayed.  There could be one more row
  161.         partially displayed.
  162.  
  163.     Protected members, for implementors of TCustomGrid descendents
  164.       DesignOptionBoost
  165.         Options mixed in only at design time to aid design-time editing.
  166.         Default = [goColSizing, goRowSizing], which makes grid cols and rows
  167.         resizeable at design time, regardless of the Options settings.
  168.       VirtualView
  169.         Controls the use of maximum screen clipping optimizations when the
  170.         grid window changes size.  Default = False, which means only the
  171.         area exposed by the size change will be redrawn, for less flicker.
  172.         VirtualView = True means the entire data area of the grid is redrawn
  173.         when the size changes.  This is required when the data displayed in
  174.         the grid is not bound to the number of rows or columns in the grid,
  175.         such as the dbgrid (a few grid rows displaying a view onto a million
  176.         row table).
  177.      }
  178.  
  179.   TGridOption = (goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine,
  180.     goRangeSelect, goDrawFocusSelected, goRowSizing, goColSizing, goRowMoving,
  181.     goColMoving, goEditing, goTabs, goRowSelect,
  182.     goAlwaysShowEditor, goThumbTracking);
  183.   TGridOptions = set of TGridOption;
  184.   TGridDrawState = set of (gdSelected, gdFocused, gdFixed);
  185.   TGridScrollDirection = set of (sdLeft, sdRight, sdUp, sdDown);
  186.  
  187.   TGridCoord = record
  188.     X: Longint;
  189.     Y: Longint;
  190.   end;
  191.  
  192.   TGridRect = record
  193.     case Integer of
  194.       0: (Left, Top, Right, Bottom: Longint);
  195.       1: (TopLeft, BottomRight: TGridCoord);
  196.   end;
  197.  
  198.   TEditStyle =  (esSimple, esEllipsis, esPickList);
  199.  
  200.   TSelectCellEvent = procedure (Sender: TObject; ACol, ARow: Longint;
  201.     var CanSelect: Boolean) of object;
  202.   TDrawCellEvent = procedure (Sender: TObject; ACol, ARow: Longint;
  203.     Rect: TRect; State: TGridDrawState) of object;
  204.  
  205.   TCustomGrid = class(TCustomControl)
  206.   protected
  207.     FGridState: TGridState;
  208.     FSaveCellExtents: Boolean;
  209.     DesignOptionsBoost: TGridOptions;
  210.     VirtualView: Boolean;
  211.     procedure CalcDrawInfo(var DrawInfo: TGridDrawInfo);
  212.     procedure CalcFixedInfo(var DrawInfo: TGridDrawInfo);
  213.     procedure CalcSizingState(X, Y: Integer; var State: TGridState;
  214.       var Index: Longint; var SizingPos, SizingOfs: Integer;
  215.       var FixedInfo: TGridDrawInfo); virtual;
  216.     procedure ChangeGridOrientation(RightToLeftOrientation: Boolean);
  217.     function CreateEditor: TInplaceEdit; virtual;
  218.     procedure CreateParams(var Params: TCreateParams); override;
  219.     procedure KeyDown(var Key: Word; Shift: TShiftState); override;
  220.     procedure KeyPress(var Key: Char); override;
  221.     procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
  222.       X, Y: Integer); override;
  223.     procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
  224.     procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
  225.       X, Y: Integer); override;
  226.     procedure AdjustSize(Index, Amount: Longint; Rows: Boolean); reintroduce; dynamic;
  227.     function BoxRect(ALeft, ATop, ARight, ABottom: Longint): TRect;
  228.     procedure DoExit; override;
  229.     function CellRect(ACol, ARow: Longint): TRect;
  230.     function CanEditAcceptKey(Key: Char): Boolean; dynamic;
  231.     function CanGridAcceptKey(Key: Word; Shift: TShiftState): Boolean; dynamic;
  232.     function CanEditModify: Boolean; dynamic;
  233.     function CanEditShow: Boolean; virtual;
  234.     function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
  235.     function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
  236.     procedure FocusCell(ACol, ARow: Longint; MoveAnchor: Boolean);
  237.     function GetEditText(ACol, ARow: Longint): string; dynamic;
  238.     procedure SetEditText(ACol, ARow: Longint; const Value: string); dynamic;
  239.     function GetEditLimit: Integer; dynamic;
  240.     function GetEditMask(ACol, ARow: Longint): string; dynamic;
  241.     function GetEditStyle(ACol, ARow: Longint): TEditStyle; dynamic;
  242.     function GetGridWidth: Integer;
  243.     function GetGridHeight: Integer;
  244.     procedure HideEdit;
  245.     procedure HideEditor;
  246.     procedure ShowEditor;
  247.     procedure ShowEditorChar(Ch: Char);
  248.     procedure InvalidateEditor;
  249.     procedure InvalidateGrid;
  250.     procedure MoveColumn(FromIndex, ToIndex: Longint);
  251.     procedure ColumnMoved(FromIndex, ToIndex: Longint); dynamic;
  252.     procedure MoveRow(FromIndex, ToIndex: Longint);
  253.     procedure RowMoved(FromIndex, ToIndex: Longint); dynamic;
  254.     procedure DrawCell(ACol, ARow: Longint; ARect: TRect;
  255.       AState: TGridDrawState); virtual; abstract;
  256.     procedure DefineProperties(Filer: TFiler); override;
  257.     procedure MoveColRow(ACol, ARow: Longint; MoveAnchor, Show: Boolean);
  258.     function SelectCell(ACol, ARow: Longint): Boolean; virtual;
  259.     procedure SizeChanged(OldColCount, OldRowCount: Longint); dynamic;
  260.     function Sizing(X, Y: Integer): Boolean;
  261.     procedure ScrollData(DX, DY: Integer);
  262.     procedure InvalidateCell(ACol, ARow: Longint);
  263.     procedure InvalidateCol(ACol: Longint);
  264.     procedure InvalidateRow(ARow: Longint);
  265.     procedure TopLeftChanged; dynamic;
  266.     procedure TimedScroll(Direction: TGridScrollDirection); dynamic;
  267.     procedure Paint; override;
  268.     procedure ColWidthsChanged; dynamic;
  269.     procedure RowHeightsChanged; dynamic;
  270.     procedure DeleteColumn(ACol: Longint); virtual;
  271.     procedure DeleteRow(ARow: Longint); virtual;
  272.     procedure UpdateDesigner;
  273.     function BeginColumnDrag(var Origin, Destination: Integer;
  274.       const MousePt: TPoint): Boolean; dynamic;
  275.     function BeginRowDrag(var Origin, Destination: Integer;
  276.       const MousePt: TPoint): Boolean; dynamic;
  277.     function CheckColumnDrag(var Origin, Destination: Integer;
  278.       const MousePt: TPoint): Boolean; dynamic;
  279.     function CheckRowDrag(var Origin, Destination: Integer;
  280.       const MousePt: TPoint): Boolean; dynamic;
  281.     function EndColumnDrag(var Origin, Destination: Integer;
  282.       const MousePt: TPoint): Boolean; dynamic;
  283.     function EndRowDrag(var Origin, Destination: Integer;
  284.       const MousePt: TPoint): Boolean; dynamic;
  285.     property BorderStyle: TBorderStyle default bsSingle;
  286.     property Col: Longint;
  287.     property Color default clWindow;
  288.     property ColCount: Longint default 5;
  289.     property ColWidths[Index: Longint]: Integer;
  290.     property DefaultColWidth: Integer default 64;
  291.     property DefaultDrawing: Boolean default True;
  292.     property DefaultRowHeight: Integer default 24;
  293.     property EditorMode: Boolean;
  294.     property FixedColor: TColor default clBtnFace;
  295.     property FixedCols: Integer default 1;
  296.     property FixedRows: Integer default 1;
  297.     property GridHeight: Integer;
  298.     property GridLineWidth: Integer default 1;
  299.     property GridWidth: Integer;
  300.     property HitTest: TPoint;
  301.     property InplaceEditor: TInplaceEdit;
  302.     property LeftCol: Longint;
  303.     property Options: TGridOptions default [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect];
  304.     property ParentColor default False;
  305.     property Row: Longint;
  306.     property RowCount: Longint default 5;
  307.     property RowHeights[Index: Longint]: Integer;
  308.     property ScrollBars: TScrollStyle default ssBoth;
  309.     property Selection: TGridRect;
  310.     property TabStops[Index: Longint]: Boolean;
  311.     property TopRow: Longint;
  312.     property VisibleColCount: Integer;
  313.     property VisibleRowCount: Integer;
  314.   public
  315.     constructor Create(AOwner: TComponent); override;
  316.     destructor Destroy; override;
  317.     function MouseCoord(X, Y: Integer): TGridCoord;
  318.   published
  319.     property TabStop default True;
  320.   end;
  321.  
  322.   { TCustomDrawGrid }
  323.  
  324.   { A grid relies on the OnDrawCell event to display the cells.
  325.      CellRect
  326.        This method returns control relative screen coordinates of the cell or
  327.        an empty rectangle if the cell is not visible.
  328.      EditorMode
  329.        Setting to true shows the editor, as if the F2 key was pressed, when
  330.        goEditing is turned on and goAlwaysShowEditor is turned off.
  331.      MouseToCell
  332.        Takes control relative screen X, Y location and fills in the column and
  333.        row that contain that point.
  334.      OnColumnMoved
  335.        Called when the user request to move a column with the mouse when
  336.        the goColMoving option is on.
  337.      OnDrawCell
  338.        This event is passed the same information as the DrawCell method
  339.        discussed above.
  340.      OnGetEditMask
  341.        Called to retrieve edit mask in the inplace editor when goEditing is
  342.        turned on.
  343.      OnGetEditText
  344.        Called to retrieve text to edit when goEditing is turned on.
  345.      OnRowMoved
  346.        Called when the user request to move a row with the mouse when
  347.        the goRowMoving option is on.
  348.      OnSetEditText
  349.        Called when goEditing is turned on to reflect changes to the text
  350.        made by the editor.
  351.      OnTopLeftChanged
  352.        Invoked when TopRow or LeftCol change. }
  353.  
  354.   TGetEditEvent = procedure (Sender: TObject; ACol, ARow: Longint; var Value: string) of object;
  355.   TSetEditEvent = procedure (Sender: TObject; ACol, ARow: Longint; const Value: string) of object;
  356.   TMovedEvent = procedure (Sender: TObject; FromIndex, ToIndex: Longint) of object;
  357.  
  358.   TCustomDrawGrid = class(TCustomGrid)
  359.   protected
  360.     procedure ColumnMoved(FromIndex, ToIndex: Longint); override;
  361.     procedure DrawCell(ACol, ARow: Longint; ARect: TRect;
  362.       AState: TGridDrawState); override;
  363.     function GetEditMask(ACol, ARow: Longint): string; override;
  364.     function GetEditText(ACol, ARow: Longint): string; override;
  365.     procedure RowMoved(FromIndex, ToIndex: Longint); override;
  366.     function SelectCell(ACol, ARow: Longint): Boolean; override;
  367.     procedure SetEditText(ACol, ARow: Longint; const Value: string); override;
  368.     procedure TopLeftChanged; override;
  369.     property OnColumnMoved: TMovedEvent;
  370.     property OnDrawCell: TDrawCellEvent;
  371.     property OnGetEditMask: TGetEditEvent;
  372.     property OnGetEditText: TGetEditEvent;
  373.     property OnRowMoved: TMovedEvent;
  374.     property OnSelectCell: TSelectCellEvent;
  375.     property OnSetEditText: TSetEditEvent;
  376.     property OnTopLeftChanged: TNotifyEvent;
  377.   public
  378.     function CellRect(ACol, ARow: Longint): TRect;
  379.     procedure MouseToCell(X, Y: Integer; var ACol, ARow: Longint);
  380.     property Canvas;
  381.     property Col;
  382.     property ColWidths;
  383.     property EditorMode;
  384.     property GridHeight;
  385.     property GridWidth;
  386.     property LeftCol;
  387.     property Selection;
  388.     property Row;
  389.     property RowHeights;
  390.     property TabStops;
  391.     property TopRow;
  392.   end;
  393.  
  394.   { TDrawGrid }
  395.  
  396.   TDrawGrid = class(TCustomDrawGrid)
  397.   published
  398.     property Align;
  399.     property Anchors;
  400.     property BiDiMode;
  401.     property BorderStyle;
  402.     property Color;
  403.     property ColCount;
  404.     property Constraints;
  405.     property Ctl3D;
  406.     property DefaultColWidth;
  407.     property DefaultRowHeight;
  408.     property DefaultDrawing;
  409.     property DragCursor;
  410.     property DragKind;
  411.     property DragMode;
  412.     property Enabled;
  413.     property FixedColor;
  414.     property FixedCols;
  415.     property RowCount;
  416.     property FixedRows;
  417.     property Font;
  418.     property GridLineWidth;
  419.     property Options;
  420.     property ParentBiDiMode;
  421.     property ParentColor;
  422.     property ParentCtl3D;
  423.     property ParentFont;
  424.     property ParentShowHint;
  425.     property PopupMenu;
  426.     property ScrollBars;
  427.     property ShowHint;
  428.     property TabOrder;
  429.     property Visible;
  430.     property VisibleColCount;
  431.     property VisibleRowCount;
  432.     property OnClick;
  433.     property OnColumnMoved;
  434.     property OnContextPopup;
  435.     property OnDblClick;
  436.     property OnDragDrop;
  437.     property OnDragOver;
  438.     property OnDrawCell;
  439.     property OnEndDock;
  440.     property OnEndDrag;
  441.     property OnEnter;
  442.     property OnExit;
  443.     property OnGetEditMask;
  444.     property OnGetEditText;
  445.     property OnKeyDown;
  446.     property OnKeyPress;
  447.     property OnKeyUp;
  448.     property OnMouseDown;
  449.     property OnMouseMove;
  450.     property OnMouseUp;
  451.     property OnMouseWheelDown;
  452.     property OnMouseWheelUp;
  453.     property OnRowMoved;
  454.     property OnSelectCell;
  455.     property OnSetEditText;
  456.     property OnStartDock;
  457.     property OnStartDrag;
  458.     property OnTopLeftChanged;
  459.   end;
  460.  
  461.   { TStringGrid }
  462.  
  463.   { TStringGrid adds to TDrawGrid the ability to save a string and associated
  464.     object (much like TListBox).  It also adds to the DefaultDrawing the drawing
  465.     of the string associated with the current cell.
  466.       Cells
  467.         A ColCount by RowCount array of strings which are associated with each
  468.         cell.  By default, the string is drawn into the cell before OnDrawCell
  469.         is called.  This can be turned off (along with all the other default
  470.         drawing) by setting DefaultDrawing to false.
  471.       Cols
  472.         A TStrings object that contains the strings and objects in the column
  473.         indicated by Index.  The TStrings will always have a count of RowCount.
  474.         If a another TStrings is assigned to it, the strings and objects beyond
  475.         RowCount are ignored.
  476.       Objects
  477.         A ColCount by Rowcount array of TObject's associated with each cell.
  478.         Object put into this array will *not* be destroyed automatically when
  479.         the grid is destroyed.
  480.       Rows
  481.         A TStrings object that contains the strings and objects in the row
  482.         indicated by Index.  The TStrings will always have a count of ColCount.
  483.         If a another TStrings is assigned to it, the strings and objects beyond
  484.         ColCount are ignored. }
  485.  
  486.   TStringGrid = class;
  487.  
  488.   TStringGridStrings = class(TStrings)
  489.   protected
  490.     function Get(Index: Integer): string; override;
  491.     function GetCount: Integer; override;
  492.     function GetObject(Index: Integer): TObject; override;
  493.     procedure Put(Index: Integer; const S: string); override;
  494.     procedure PutObject(Index: Integer; AObject: TObject); override;
  495.     procedure SetUpdateState(Updating: Boolean); override;
  496.   public
  497.     constructor Create(AGrid: TStringGrid; AIndex: Longint);
  498.     function Add(const S: string): Integer; override;
  499.     procedure Assign(Source: TPersistent); override;
  500.     procedure Clear; override;
  501.     procedure Delete(Index: Integer); override;
  502.     procedure Insert(Index: Integer; const S: string); override;
  503.   end;
  504.  
  505.  
  506.   TStringGrid = class(TDrawGrid)
  507.   protected
  508.     procedure ColumnMoved(FromIndex, ToIndex: Longint); override;
  509.     procedure DrawCell(ACol, ARow: Longint; ARect: TRect;
  510.       AState: TGridDrawState); override;
  511.     function GetEditText(ACol, ARow: Longint): string; override;
  512.     procedure SetEditText(ACol, ARow: Longint; const Value: string); override;
  513.     procedure RowMoved(FromIndex, ToIndex: Longint); override;
  514.   public
  515.     constructor Create(AOwner: TComponent); override;
  516.     destructor Destroy; override;
  517.     property Cells[ACol, ARow: Integer]: string;
  518.     property Cols[Index: Integer]: TStrings;
  519.     property Objects[ACol, ARow: Integer]: TObject;
  520.     property Rows[Index: Integer]: TStrings;
  521.   end;
  522.  
  523.   { TInplaceEditList }
  524.  
  525.   { TInplaceEditList adds to TInplaceEdit the ability to drop down a pick list
  526.     of possible values or to display an ellipsis button which will invoke
  527.     user code in an event to bring up a modal dialog.  The EditStyle property
  528.     determines which type of button to draw (if any)
  529.       ActiveList
  530.         TWinControl reference which typically points to the internal
  531.         PickList.  May be set to a different list by descendent inplace
  532.         editors which provide additional functionality.
  533.       ButtonWidth
  534.         The width of the button used to drop down the pick list.
  535.       DropDownRows
  536.         The maximum number of rows to display at a time in the pick list.
  537.       EditStyle
  538.         Indicates what type of list to display (none, custom, or picklist).
  539.       ListVisible
  540.         Indicates if the list is currently dropped down.
  541.       PickList
  542.         Reference to the internal PickList (a TCustomListBox).
  543.       Pressed
  544.         Indicates if the button is currently pressed.}
  545.  
  546.   TOnGetPickListItems = procedure(ACol, ARow: Integer; Items: TStrings) of Object;
  547.  
  548.   TInplaceEditList = class(TInPlaceEdit)
  549.   protected
  550.     procedure BoundsChanged; override;
  551.     function ButtonRect: TRect;
  552.     procedure CloseUp(Accept: Boolean); dynamic;
  553.     procedure DblClick; override;
  554.     procedure DoDropDownKeys(var Key: Word; Shift: TShiftState); virtual;
  555.     procedure DoEditButtonClick; virtual;
  556.     procedure DoGetPickListItems; dynamic;
  557.     procedure DropDown; dynamic;
  558.     procedure KeyDown(var Key: Word; Shift: TShiftState); override;
  559.     procedure ListMouseUp(Sender: TObject; Button: TMouseButton;
  560.       Shift: TShiftState; X, Y: Integer);
  561.     procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
  562.       X, Y: Integer); override;
  563.     procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
  564.     procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
  565.       X, Y: Integer); override;
  566.     function OverButton(const P: TPoint): Boolean;
  567.     procedure PaintWindow(DC: HDC); override;
  568.     procedure StopTracking;
  569.     procedure TrackButton(X,Y: Integer);
  570.     procedure UpdateContents; override;
  571.     procedure WndProc(var Message: TMessage); override;
  572.   public
  573.     constructor Create(Owner: TComponent); override;
  574.     procedure RestoreContents;
  575.     property ActiveList: TWinControl;
  576.     property ButtonWidth: Integer;
  577.     property DropDownRows: Integer;
  578.     property EditStyle: TEditStyle;
  579.     property ListVisible: Boolean;
  580.     property PickList: TCustomListbox;
  581.     property PickListLoaded: Boolean;
  582.     property Pressed: Boolean;
  583.     property OnEditButtonClick: TNotifyEvent;
  584.     property OnGetPickListitems: TOnGetPickListItems;
  585.   end;
  586.  
  587.  
  588. implementation
  589.